function get_random_page() { $this->db->order_by('id', 'RANDOM'); or $this->db->order_by('rand()'); $this->db->limit(1); $query = $this->db->get('pages'); return $query->result_array(); }